<template>
  <div>
    <el-row :gutter="15">

      <el-tabs  v-model="activexdivdv"  tab-position="top" class="mb-20">
        <el-tab-pane  label="原数据">
          <el-form ref="elForm" :model="dataForm.oldData" :rules="dataRule" size="small" label-width="100px" label-position="right"  :disabled="true" >
            <template >
              <!--          v-if="!loading && formOperates"-->
              <el-card class="mb-20" shadow ="always" header="权证信息">
                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_useNature')"
                >
                  <el-form-item label="产权类别"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_useNature"
                  >
                    <el-select v-model="dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_useNature" v-if="!setting.readonly"
                               placeholder="请选择" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_useNature')"
                               clearable :style='{"width":"100%"}'
                    >
                      <el-option v-for="(item, index) in jnpf_zcgl_zcdj_warrant_jnpf_useNatureOptions" :key="index"
                                 :label="item.fullName" :value="item.enCode" :disabled="item.disabled"
                      ></el-option>
                    </el-select>

                    <span class="value" v-if="setting.readonly">{{
                        getOptionLabel(jnpf_zcgl_zcdj_warrant_jnpf_useNatureOptions, dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_useNature) || '-'
                      }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_custodyLocation') && dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="权证单位"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_custodyLocation"
                  >
                    <el-input v-model="dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_custodyLocation" v-if="!setting.readonly"
                              placeholder="请输入" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_custodyLocation')"
                              clearable :style='{"width":"100%"}'
                    >
                    </el-input>

                    <span class="value" v-if="setting.readonly">{{
                        dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_custodyLocation || '-'
                      }}</span>

                  </el-form-item>
                </el-col>

                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_warrantNumber')  && dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="产权证号"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_warrantNumber"
                  >
                    <el-input v-model="dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_warrantNumber" v-if="!setting.readonly"
                              placeholder="请输入" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_warrantNumber')"
                              clearable :style='{"width":"100%"}'
                    >
                    </el-input>

                    <span class="value" v-if="setting.readonly">{{
                        dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_warrantNumber
                      }}</span>
                  </el-form-item>
                </el-col>

                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_propertyRight')  && dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="产权性质"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_propertyRight"
                  >
                    <el-select v-model="dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_propertyRight"
                               placeholder="请选择" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_propertyRight')"
                               clearable :style='{"width":"100%"}' v-if="!setting.readonly"
                    >
                      <el-option v-for="(item, index) in jnpf_zcgl_zcdj_warrant_jnpf_propertyRightOptions" :key="index"
                                 :label="item.fullName" :value="item.enCode" :disabled="item.disabled"
                      ></el-option>

                    </el-select>

                    <span class="value" v-if="setting.readonly"> {{
                        getOptionLabel(jnpf_zcgl_zcdj_warrant_jnpf_propertyRightOptions, dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_propertyRight) || '-'
                      }}</span>

                  </el-form-item>
                </el-col>


                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_propertyRightDescribe')  && dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_propertyRight == 'cqxzqt'  && dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="其他权力性质说明"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_propertyRightDescribe"
                  >
                    <el-input v-model="dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_propertyRightDescribe" v-if="!setting.readonly"
                              placeholder="请输入" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_propertyRightDescribe')"
                              clearable :style='{"width":"100%"}'
                    >
                    </el-input>

                    <span class="value" v-if="setting.readonly">{{
                        dataForm.jnpf_zcgl_zcdj_warrant_jnpf_propertyRightDescribe
                      }}</span>
                  </el-form-item>
                </el-col>












                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_warrantType')  && dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="权利类型"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_warrantType"
                  >
                    <el-select v-model="dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_warrantType" v-if="!setting.readonly"
                               placeholder="请选择" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_warrantType')"
                               clearable :style='{"width":"100%"}'
                    >
                      <el-option v-for="(item, index) in jnpf_zcgl_zcdj_warrant_jnpf_warrantTypeOptions" :key="index"
                                 :label="item.fullName" :value="item.enCode" :disabled="item.disabled"
                      ></el-option>
                    </el-select>

                    <span class="value" v-if="setting.readonly">{{
                        getOptionLabel(jnpf_zcgl_zcdj_warrant_jnpf_warrantTypeOptions, dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_warrantType) || '-'
                      }}</span>
                  </el-form-item>
                </el-col>

                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_warrantStyleDescribe')  && dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_warrantType == 'cclxqt'  && dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="其他权力类型说明"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_warrantStyleDescribe"
                  >
                    <el-input v-model="dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_warrantStyleDescribe" v-if="!setting.readonly"
                              placeholder="请输入" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_warrantStyleDescribe')"
                              clearable :style='{"width":"100%"}'
                    >
                    </el-input>

                    <span class="value" v-if="setting.readonly">{{
                        dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_warrantStyleDescribe
                      }}</span>
                  </el-form-item>
                </el-col>






                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_issuanceTime')  && dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="发证时间"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_issuanceTime"
                  >
                    <el-date-picker v-model="dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_issuanceTime" v-if="!setting.readonly"
                                    placeholder="请选择" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_issuanceTime')"
                                    clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd"
                    >
                    </el-date-picker>

                    <span class="value" v-if="setting.readonly">{{ dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_issuanceTime }}</span>

                  </el-form-item>
                </el-col>
                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_startTime')  && dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="开始使用时间"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_startTime"
                  >
                    <el-date-picker v-model="dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_startTime" v-if="!setting.readonly"
                                    placeholder="请选择" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_startTime')"
                                    clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd"

                    >
                    </el-date-picker>

                    <span class="value" v-if="setting.readonly">{{ dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_startTime }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_endTime')  && dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="使用到期时间"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_endTime"
                  >
                    <el-date-picker v-model="dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_endTime" v-if="!setting.readonly"
                                    placeholder="请选择" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_endTime')"
                                    clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd"

                    >
                    </el-date-picker>

                    <span class="value" v-if="setting.readonly">{{ dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_endTime }}</span>
                  </el-form-item>
                </el-col>


                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_productionFile')"
                >
                  <el-form-item label="产证附件"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_productionFile"
                  >
                    <JNPF-UploadFz v-model="dataForm.oldData.jnpf_zcgl_zcdj_warrant_jnpf_productionFile"
                                   :fileSize="10" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_productionFile')"
                                   sizeUnit="MB" :limit="9" buttonText="点击上传"
                    >
                    </JNPF-UploadFz>
                  </el-form-item>
                </el-col>
              </el-card>
            </template>
          </el-form>
        </el-tab-pane >
        <el-tab-pane  label="变更数据">
          <el-form ref="elForm" :model="dataForm.newData" :rules="dataRule" size="small" label-width="100px" label-position="right"  :disabled="setting.readonly" >
            <template >
              <!--          v-if="!loading && formOperates"-->
              <el-card class="mb-20" shadow ="always" header="权证信息">
                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_useNature')"
                >
                  <el-form-item label="产权类别"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_useNature"
                  >
                    <el-select v-model="dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_useNature" v-if="!setting.readonly"
                               placeholder="请选择" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_useNature')"
                               clearable :style='{"width":"100%"}'
                    >
                      <el-option v-for="(item, index) in jnpf_zcgl_zcdj_warrant_jnpf_useNatureOptions" :key="index"
                                 :label="item.fullName" :value="item.enCode" :disabled="item.disabled"
                      ></el-option>
                    </el-select>

                    <span class="value" v-if="setting.readonly">{{
                        getOptionLabel(jnpf_zcgl_zcdj_warrant_jnpf_useNatureOptions, dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_useNature) || '-'
                      }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_custodyLocation') && dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="权证单位"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_custodyLocation"
                  >
                    <el-input v-model="dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_custodyLocation" v-if="!setting.readonly"
                              placeholder="请输入" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_custodyLocation')"
                              clearable :style='{"width":"100%"}'
                    >
                    </el-input>

                    <span class="value" v-if="setting.readonly">{{
                        dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_custodyLocation || '-'
                      }}</span>

                  </el-form-item>
                </el-col>

                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_warrantNumber')  && dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="产权证号"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_warrantNumber"
                  >
                    <el-input v-model="dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_warrantNumber" v-if="!setting.readonly"
                              placeholder="请输入" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_warrantNumber')"
                              clearable :style='{"width":"100%"}'
                    >
                    </el-input>

                    <span class="value" v-if="setting.readonly">{{
                        dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_warrantNumber
                      }}</span>
                  </el-form-item>
                </el-col>

                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_propertyRight')  && dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="产权性质"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_propertyRight"
                  >
                    <el-select v-model="dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_propertyRight"
                               placeholder="请选择" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_propertyRight')"
                               clearable :style='{"width":"100%"}' v-if="!setting.readonly"
                    >
                      <el-option v-for="(item, index) in jnpf_zcgl_zcdj_warrant_jnpf_propertyRightOptions" :key="index"
                                 :label="item.fullName" :value="item.enCode" :disabled="item.disabled"
                      ></el-option>

                    </el-select>

                    <span class="value" v-if="setting.readonly"> {{
                        getOptionLabel(jnpf_zcgl_zcdj_warrant_jnpf_propertyRightOptions, dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_propertyRight) || '-'
                      }}</span>

                  </el-form-item>
                </el-col>


                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_propertyRightDescribe')  && dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_propertyRight == 'cqxzqt'  && dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="其他权力性质说明"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_propertyRightDescribe"
                  >
                    <el-input v-model="dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_propertyRightDescribe" v-if="!setting.readonly"
                              placeholder="请输入" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_propertyRightDescribe')"
                              clearable :style='{"width":"100%"}'
                    >
                    </el-input>

                    <span class="value" v-if="setting.readonly">{{
                        dataForm.jnpf_zcgl_zcdj_warrant_jnpf_propertyRightDescribe
                      }}</span>
                  </el-form-item>
                </el-col>












                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_warrantType')  && dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="权利类型"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_warrantType"
                  >
                    <el-select v-model="dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_warrantType" v-if="!setting.readonly"
                               placeholder="请选择" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_warrantType')"
                               clearable :style='{"width":"100%"}'
                    >
                      <el-option v-for="(item, index) in jnpf_zcgl_zcdj_warrant_jnpf_warrantTypeOptions" :key="index"
                                 :label="item.fullName" :value="item.enCode" :disabled="item.disabled"
                      ></el-option>
                    </el-select>

                    <span class="value" v-if="setting.readonly">{{
                        getOptionLabel(jnpf_zcgl_zcdj_warrant_jnpf_warrantTypeOptions, dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_warrantType) || '-'
                      }}</span>
                  </el-form-item>
                </el-col>

                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_warrantStyleDescribe')  && dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_warrantType == 'cclxqt'  && dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="其他权力类型说明"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_warrantStyleDescribe"
                  >
                    <el-input v-model="dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_warrantStyleDescribe" v-if="!setting.readonly"
                              placeholder="请输入" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_warrantStyleDescribe')"
                              clearable :style='{"width":"100%"}'
                    >
                    </el-input>

                    <span class="value" v-if="setting.readonly">{{
                        dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_warrantStyleDescribe
                      }}</span>
                  </el-form-item>
                </el-col>






                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_issuanceTime')  && dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="发证时间"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_issuanceTime"
                  >
                    <el-date-picker v-model="dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_issuanceTime" v-if="!setting.readonly"
                                    placeholder="请选择" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_issuanceTime')"
                                    clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd"
                    >
                    </el-date-picker>

                    <span class="value" v-if="setting.readonly">{{ dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_issuanceTime }}</span>

                  </el-form-item>
                </el-col>
                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_startTime')  && dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="开始使用时间"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_startTime"
                  >
                    <el-date-picker v-model="dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_startTime" v-if="!setting.readonly"
                                    placeholder="请选择" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_startTime')"
                                    clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd"

                    >
                    </el-date-picker>

                    <span class="value" v-if="setting.readonly">{{ dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_startTime }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_endTime')  && dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_useNature == 'yqs'"
                >
                  <el-form-item label="使用到期时间"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_endTime"
                  >
                    <el-date-picker v-model="dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_endTime" v-if="!setting.readonly"
                                    placeholder="请选择" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_endTime')"
                                    clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd"

                    >
                    </el-date-picker>

                    <span class="value" v-if="setting.readonly">{{ dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_endTime }}</span>
                  </el-form-item>
                </el-col>


                <el-col :span="8" v-if="judgeShow('jnpf_zcgl_zcdj_warrant_jnpf_productionFile')"
                >
                  <el-form-item label="产证附件"
                                prop="jnpf_zcgl_zcdj_warrant_jnpf_productionFile"
                  >
                    <JNPF-UploadFz v-model="dataForm.newData.jnpf_zcgl_zcdj_warrant_jnpf_productionFile"
                                   :fileSize="10" :disabled="judgeWrite('jnpf_zcgl_zcdj_warrant_jnpf_productionFile')"
                                   sizeUnit="MB" :limit="9" buttonText="点击上传"
                    >
                    </JNPF-UploadFz>
                  </el-form-item>
                </el-col>
              </el-card>
            </template>
          </el-form>
        </el-tab-pane >
      </el-tabs>



    </el-row>
    <UserBox v-if="userBoxVisible" ref="userBox" @submit="submit" />
    <SelectDialog v-if="selectDialogVisible" :config="addTableConf" :formData="dataForm" ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false"/>
  </div>
</template>

<script>
import request from '@/utils/request'
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import SelectDialog from '@/components/SelectDialog'
export default {
  components: {SelectDialog  },
  props: [],
  data() {
    return {
      jnpf_zcgl_zcdj_warrant_jnpf_warrantTypeOptions: [],
      zcNatureOptions: [],
      zcNatureProps: { 'label': 'fullName', 'value': 'id' },
      zcPurposeOptions: [],
      zcPurposeProps: { 'label': 'fullName', 'value': 'id' },
      zcSourceOptions: [],
      zcSourceProps: { 'label': 'fullName', 'value': 'id' },
      affiliatedUnitOptions: [],
      affiliatedUnitProps: { 'label': 'fullName', 'value': 'id' },
      managementUnitOptions: [],
      managementUnitProps: { 'label': 'fullName', 'value': 'id' },
      jnpf_zcgl_zcdj_warrant_jnpf_propertyRightOptions: [],
      jnpf_zcgl_zcdj_warrant_jnpf_propertyRightProps: { 'label': 'fullName', 'value': 'id' },
      jnpf_zcgl_zcdj_warrant_jnpf_useNatureOptions: [],
      jnpf_zcgl_zcdj_warrant_jnpf_useNatureProps: { 'label': 'fullName', 'value': 'id' },
      activexdivdv:'1',
      selectDialogVisible: false,
      tableKey: '',
      addTableConf:{},
      loading: false,
      visible: false,
      setting:{},
      eventType: '',
      userBoxVisible:false,
      tableRequiredData: {},
      primaryKeyPolicy:true,
      dataFormNew:{},
      dataForm: {
        title:"",
        remarks:"",
        oldData:{},
        newData:{},
        id:'',
        flowId: '',
        status: 1,
        candidateList:{},
        freeapproveruserid: '',
        branchList:[],
        errorRuleUserList:{},
        flowUrgent: 1,
        version:0,
        flowtaskid:undefined,
        copyIds:'',
        project : '',
        customerName : '',
        contractNo : '',
        paymentBy : '',
        billType : '',
        expenseStartDate : '',
        expenseEndDate : '',
        planReceiptDate : '',
        billRemark : '',
        zcbillitemList:[],
      },
      dataRule:
        {
        },
      zcgl_cw_bill_itemexpenseItemOptions:[{"fullName":"选项一","id":"1"},{"fullName":"选项二","id":"2"}],
      zcgl_cw_bill_itemexpenseItemProps:{"label":"fullName","value":"id"},
    }
  },
  computed: {
    formOperates() {
      return this.setting.formOperates;
    }
  },
  watch: {},
  created() {
    // this.getColumnList(),

    this.getwarrantTypeOptions()
    this.getzcNatureOptions()
    this.getzcPurposeOptions()
    this.getzcSourceOptions()
    this.getaffiliatedUnitOptions()
    this.getmanagementUnitOptions()
    this.getjnpf_zcgl_zcdj_warrant_jnpf_propertyRightOptions()
    this.getjnpf_zcgl_zcdj_warrant_jnpf_useNatureOptions()
    this.dataAll()

  },
  mounted() {},
  methods: {

    getwarrantTypeOptions() {
      getDictionaryDataSelector('610823865056100177').then(res => {
        this.jnpf_zcgl_zcdj_warrant_jnpf_warrantTypeOptions = res.data.list
      })
    },

    getzcNatureOptions() {
      getDictionaryDataSelector('610823452110094661').then(res => {
        this.zcNatureOptions = res.data.list
      })
    },
    getzcPurposeOptions() {
      getDictionaryDataSelector('610823865056100677').then(res => {
        this.zcPurposeOptions = res.data.list
      })
    },
    getzcSourceOptions() {
      getDictionaryDataSelector('610823965094445381').then(res => {
        this.zcSourceOptions = res.data.list
      })
    },
    getaffiliatedUnitOptions() {
      getDictionaryDataSelector('610824055188095301').then(res => {
        this.affiliatedUnitOptions = res.data.list
      })
    },
    getmanagementUnitOptions() {
      getDictionaryDataSelector('610824142995849541').then(res => {
        this.managementUnitOptions = res.data.list
      })
    },
    getjnpf_zcgl_zcdj_warrant_jnpf_propertyRightOptions() {
      getDictionaryDataSelector('610826202277478725').then(res => {
        this.jnpf_zcgl_zcdj_warrant_jnpf_propertyRightOptions = res.data.list
      })
    },
    getjnpf_zcgl_zcdj_warrant_jnpf_useNatureOptions() {
      getDictionaryDataSelector('610826295164535109').then(res => {
        this.jnpf_zcgl_zcdj_warrant_jnpf_useNatureOptions = res.data.list
      })
    },
    updateDataRule() {
      let newRules = {}
      for (let i = 0; i < this.setting.formOperates.length; i++) {
        const item = this.setting.formOperates[i]
        if (!item.id.includes('-')) {
          const newRulesItem = {
            required: item.required || false,
            message: item.name + '不能为空',
            trigger: item.trigger || 'blur'
          }
          if (!this.dataRule.hasOwnProperty(item.id)) {
            if (item.required) this.$set(newRules, item.id, [newRulesItem])
          } else {
            let withoutRequiredItem = true
            for (let i = 0; i < this.dataRule[item.id].length; i++) {
              if (this.dataRule[item.id][i].hasOwnProperty('required')) {
                this.dataRule[item.id][i].required = item.required || false
                withoutRequiredItem = false
              }
            }
            if (withoutRequiredItem && item.required) this.dataRule[item.id].push(newRulesItem)
          }
        } else {
          let key = item.id.split('-')[0]
          let newId = item.id.split('-')[1]
          let newItem = {
            ...item,
            id: newId
          }
          if (!this.tableRequiredData.hasOwnProperty(key)) {
            this.$set(this.tableRequiredData, key, [newItem])
          } else {
            this.tableRequiredData[key].push(newItem)
          }
        }
      }
      this.dataRule = { ...this.dataRule, ...newRules }
    },
    exist() {
      let isOk = true;
      let messageList = [];
      for (let key in this.tableRequiredData) {
        let arr = this.tableRequiredData[key].filter((o) => o.required) || [];
        for (let k = 0; k < arr.length; k++) {
          for (let i = 0; i < this.dataForm[key].length; i++) {
            let id = arr[k].id;
            let name = arr[k].name;
            let _data = this.dataForm[key][i][id];
            let boo = true;
            if (Array.isArray(_data)) {
              boo = !this.jnpf.isEmptyArray(_data);
            } else {
              boo = !this.jnpf.isEmpty(_data);
            }
            if (!boo) {
              messageList.push(name + "不能为空");
            }
          }
        }
      }
      isOk = messageList.length == 0;
      if (messageList.length > 0) {
        this.$message.error(messageList[0], 1000)
      }
      return isOk;
    },
    dataAll(){
    },
    goBack() {
      this.$emit('refresh')
    },
    init(data) {
      if(data.flowTaskInfo!=null){



        this.dataInfo3(data.flowTaskInfo.flowFormContentJson);
        this.$emit('setPageLoad')
        this.$store.commit('generator/UPDATE_RELATION_DATA', {})
        this.loading = false
        // this.dataForm.id = data.id || "";
        this.setting = data;
        this.setting['readonly'] = true

        // this.visible = true;
        this.updateDataRule()

      }else{

        this.$store.commit('generator/UPDATE_RELATION_DATA', {})
        this.loading = true
        this.dataForm.id = data.id || ''
        this.setting = data
        this.visible = true;

        this.$nextTick(() => {
          // this.$refs['elForm'].resetFields();
          if(this.dataForm.id){
            let url  = '/api/example/ZcglZcdjInfo/' + this.dataForm.id
            if(this.dataForm.flowtaskid){
              url+='?flowtaskid='+this.dataForm.flowtaskid
            }
            request({
              url: url,
              method: 'get'
            }).then(res => {
              this.dataInfo(res.data)
              this.updateDataRule()
            })
          }
          this.loading = false
          this.$emit('setPageLoad')
        })
      }


    },
    // 表单提交
    dataFormSubmit(eventType,flowUrgent) {
      this.$refs['elForm'].validate((valid) => {
        if (valid) {
          if (!this.exist()) return
          if (eventType === 'audit' || eventType === 'reject') {
            var _data =this.dataList()
            this.$emit('eventReceiver', _data, eventType)
            return
          }
          this.dataForm.status = eventType === 'submit' ? 0 : 1
          this.dataForm.flowUrgent = flowUrgent
          this.dataForm.flowId = this.setting.flowId;
          this.eventType = eventType
          if (this.eventType === 'submit') {
            this.$confirm('您确定要提交当前流程吗, 是否继续?', '提示', {
              type: 'warning'
            }).then(() => {
              this.request()
            }).catch(() => { });
          } else {
            this.request()
          }
        }
      })
    },
    request() {
      var _data =this.dataList()

      console.log("caoshi1"+JSON.stringify(_data))

      var id = this.dataForm.id
      delete  this.dataForm.id

      _data.type  = "2"
      _data.zcdgId  = id
      _data.newData.zcgl_zcdj_warrant = {}
      _data.newData.zcgl_zcdj_warrant.propertyRight = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_propertyRight;
      _data.newData.zcgl_zcdj_warrant.warrantNumber = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_warrantNumber;
      _data.newData.zcgl_zcdj_warrant.landUse = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_landUse;
      _data.newData.zcgl_zcdj_warrant.housePurpose = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_housePurpose;
      _data.newData.zcgl_zcdj_warrant.zzPropertyOwner = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_zzPropertyOwner;
      _data.newData.zcgl_zcdj_warrant.xzPropertyOwner = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_xzPropertyOwner;
      _data.newData.zcgl_zcdj_warrant.address = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_address;
      _data.newData.zcgl_zcdj_warrant.useNature = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_useNature;
      _data.newData.zcgl_zcdj_warrant.buildings = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_buildings;
      _data.newData.zcgl_zcdj_warrant.layers = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_layers;
      _data.newData.zcgl_zcdj_warrant.numberFloors = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_numberFloors;
      _data.newData.zcgl_zcdj_warrant.startTime = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_startTime;
      _data.newData.zcgl_zcdj_warrant.endTime = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_endTime;
      _data.newData.zcgl_zcdj_warrant.issuanceTime = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_issuanceTime;
      _data.newData.zcgl_zcdj_warrant.custodyLocation = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_custodyLocation;
      _data.newData.zcgl_zcdj_warrant.notes = _data.newData.jnpf_zcgl_zcdj_warrant_jnpf_notes;

      if (!this.dataForm.id) {
        request({
          url: '/api/example/ZcglZcdjInfoChange',
          method: 'post',
          data: _data
        }).then((res) => {
          this.$message({
            message: res.msg,
            type: 'success',
            duration: 1000,
            onClose: () => {
              this.visible = false
              this.$emit('close', true)
            }
          })
        })
      }else{
        request({
          url: '/api/ZcglCwBillChange/'+this.dataForm.id,
          method: 'PUT',
          data: _data
        }).then((res) => {
          this.$message({
            message: res.msg,
            type: 'success',
            duration: 1000,
            onClose: () => {
              this.visible = false
              this.$emit('close', true)
            }
          })
        })
      }
    },
    judgeShow(id) {
      if (!this.setting.formOperates || !this.setting.formOperates.length) return true
      let arr = this.setting.formOperates.filter(o => o.id === id) || []
      if (!arr.length) return true
      let item = arr[0]
      return item.read
    },
    judgeWrite(id) {
      if (!this.setting.formOperates || !this.setting.formOperates.length) return false
      let arr = this.setting.formOperates.filter(o => o.id === id) || []
      if (!arr.length) return true
      let item = arr[0]
      return !item.write
    },
    judgeRequired(id) {
      if (!this.setting.formOperates || !this.setting.formOperates.length) return false
      let arr = this.setting.formOperates.filter(o => o.id === id) || []
      if (!arr.length) return true
      let item = arr[0]
      return item.required
    },
    addzcbillitemList(){
      this.tableKey = 'zcbillitemList';
      let item = {
        expenseItem:undefined,
        receiveAmount:undefined,
      }
      this.dataForm.zcbillitemList.push(item)
    },
    delzcbillitemList(index) {
      this.dataForm.zcbillitemList.splice(index, 1);
    },
    // 获取选项标签
    getOptionLabel(options, value) {
      const item = options.find(opt => opt.id === value);
      return item ? item.fullName : '';
    },
    dataList(){
      var _data = JSON.parse(JSON.stringify(this.dataForm));
      // for(let i=0;i<_data.zcbillitemList.length;i++){
      //   var _list = _data.zcbillitemList[i];
      //   _list.expenseItem = _list.expenseItem
      // }
      return _data;
    },

    dataInfo3(dataAll){

      let _dataAll =JSON.parse(dataAll)
      console.log('asas阿萨·' + _dataAll)
      console.log('asas阿萨·' + _dataAll.oldData)

      function safeParseJSON(data) {
        try {
          return typeof data === 'string' ? JSON.parse(data) : data;
        } catch (e) {
          console.error('Parsing error:', e);
          return null; // 或者根据需要返回其他默认值
        }
      }
// 处理 oldData 中的 zcFile 和 zcFmImage
      if (_dataAll.oldData) {
        let oldDataParsed = safeParseJSON(_dataAll.oldData);
        if (oldDataParsed) {

          oldDataParsed.zcFile =  oldDataParsed.zcFile ? JSON.parse( oldDataParsed.zcFile) : []
          oldDataParsed.zcFmImage =  oldDataParsed.zcFmImage ? JSON.parse( oldDataParsed.zcFmImage) : []

          // oldDataParsed.zcFile = safeParseJSON(oldDataParsed.zcFile) || '';
          // oldDataParsed.zcFmImage = safeParseJSON(oldDataParsed.zcFmImage) || '';
        }
      }

// 处理 newData 中的 zcFile 和 zcFmImage
      if (_dataAll.newData) {
        let newDataParsed = safeParseJSON(_dataAll.newData);
        if (newDataParsed) {

          newDataParsed.productionImage =  newDataParsed.productionImage ? JSON.parse( newDataParsed.productionImage) : []
          newDataParsed.productionFile =  newDataParsed.productionFile ? JSON.parse( newDataParsed.productionFile) : []

          // newDataParsed.productionImage = safeParseJSON(newDataParsed.productionImage) || '';
          // // 注意：这里我们不再双重解析 newData.zcFmImage
          // newDataParsed.productionFile = safeParseJSON(newDataParsed.productionFile) || '';
        }
      }

      this.dataForm =_dataAll
      if(typeof this.dataForm.oldData === 'string'  ){
        this.dataForm.oldData = JSON.parse(this.dataForm.oldData)

      }else{
        this.dataForm.oldData = this.dataForm.oldData
      }

      if( typeof this.dataForm.newData === 'string'  ){
        this.dataForm.newData = JSON.parse(this.dataForm.newData)

      }else{
        this.dataForm.newData = this.dataForm.newData
      }



      // this.dataFormNew = JSON.parse(JSON.stringify(this.dataForm))
    },

    dataInfo(dataAll){
      let _dataAll =dataAll
      if(_dataAll.productionImage!=null && dataAll.productionImage!=''){
        _dataAll.productionImage = JSON.parse(_dataAll.productionImage)

      }else{
        _dataAll.productionImage= ''
      }
      if(_dataAll.productionFile!=null && dataAll.productionFile!=''){
        _dataAll.productionFile = JSON.parse(_dataAll.productionFile)

      }else{
        _dataAll.productionFile= ''
      }
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_propertyRight = _dataAll.zcgl_zcdj_warrant.propertyRight
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_warrantNumber = _dataAll.zcgl_zcdj_warrant.warrantNumber
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_landUse = _dataAll.zcgl_zcdj_warrant.landUse
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_housePurpose = _dataAll.zcgl_zcdj_warrant.housePurpose
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_zzPropertyOwner = _dataAll.zcgl_zcdj_warrant.zzPropertyOwner
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_xzPropertyOwner = _dataAll.zcgl_zcdj_warrant.xzPropertyOwner
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_address = _dataAll.zcgl_zcdj_warrant.address
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_useNature = _dataAll.zcgl_zcdj_warrant.useNature
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_buildings = _dataAll.zcgl_zcdj_warrant.buildings
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_layers = _dataAll.zcgl_zcdj_warrant.layers
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_numberFloors = _dataAll.zcgl_zcdj_warrant.numberFloors
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_startTime = _dataAll.zcgl_zcdj_warrant.startTime
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_endTime = _dataAll.zcgl_zcdj_warrant.endTime
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_issuanceTime = _dataAll.zcgl_zcdj_warrant.issuanceTime
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_custodyLocation = _dataAll.zcgl_zcdj_warrant.custodyLocation
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_notes = _dataAll.zcgl_zcdj_warrant.notes

      // _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_productionFile = JSON.parse(_dataAll.zcgl_zcdj_warrant.productionFile)
      // _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_productionImage = JSON.parse(_dataAll.zcgl_zcdj_warrant.productionImage)
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_productionFile =  _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_productionFile ? JSON.parse(_dataAll.jnpf_zcgl_zcdj_warrant_jnpf_productionFile) : []
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_productionImage =  _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_productionImage ? JSON.parse( _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_productionImage) : []

      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_warrantType = _dataAll.zcgl_zcdj_warrant.warrantType
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_propertyRightDescribe = _dataAll.zcgl_zcdj_warrant.propertyRightDescribe
      _dataAll.jnpf_zcgl_zcdj_warrant_jnpf_warrantStyleDescribe = _dataAll.zcgl_zcdj_warrant.warrantStyleDescribe



      _dataAll.jnpf_zcgl_zcdj_area_jnpf_buildingArea = _dataAll.zcgl_zcdj_area.buildingArea
      _dataAll.jnpf_zcgl_zcdj_area_jnpf_landArea = _dataAll.zcgl_zcdj_area.landArea
      _dataAll.jnpf_zcgl_zcdj_area_jnpf_sharedLandArea = _dataAll.zcgl_zcdj_area.sharedLandArea
      _dataAll.jnpf_zcgl_zcdj_area_jnpf_buildingMeasurementArea = _dataAll.zcgl_zcdj_area.buildingMeasurementArea
      _dataAll.jnpf_zcgl_zcdj_area_jnpf_landSurveyArea = _dataAll.zcgl_zcdj_area.landSurveyArea
      _dataAll.jnpf_zcgl_zcdj_area_jnpf_exclusiveArea = _dataAll.zcgl_zcdj_area.exclusiveArea
      _dataAll.jnpf_zcgl_zcdj_area_jnpf_sharedArea = _dataAll.zcgl_zcdj_area.sharedArea
      _dataAll.jnpf_zcgl_zcdj_photo_jnpf_photoTime = _dataAll.zcgl_zcdj_photo.photoTime
      _dataAll.jnpf_zcgl_zcdj_photo_jnpf_photoImage =  _dataAll.jnpf_zcgl_zcdj_photo_jnpf_photoImage ? JSON.parse( _dataAll.jnpf_zcgl_zcdj_photo_jnpf_photoImage) : []

      // _dataAll.jnpf_zcgl_zcdj_photo_jnpf_photoImage = JSON.parse(_dataAll.zcgl_zcdj_photo.photoImage)
      this.dataForm.oldData =_dataAll
      this.dataForm.newData =JSON.parse(JSON.stringify(this.dataForm.oldData))
    },

    addForSelect(data){
      for (let i = 0; i < data.length; i++) {
        let item = data[i]
        this.dataForm[this.tableKey].push(item)
      }
    },
  },
}

</script>
<style scoped>
.el-textarea.is-disabled .el-textarea__inner{

  color: black!important;
}
.el-input.is-disabled .el-input__inner{
  color: black!important;

}
/deep/.el-input__inner{
  background: white !important;

}

/deep/.el-textarea__inner{
  background: white !important;
}
.el-input.is-disabled .el-input__inner{

  background: white !important;
}
</style>
